<template>
  <section class="book-item-city" @click.stop="todetail">
    <img v-lazy="book.cover"/>
    <div class="content">
      <div class="title">{{book.name}}</div>
      <div class="author">{{book.author}}</div>
      <div class="gold">可获得金币{{book.gold_coin || 0}}个，已获得金币{{book.get_gold_coin || 0}}个</div>
    </div>
    <i class="icon-arrow-right" style="font-size:20px;"/>
  </section>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  props: {
    book: {
      type: Object,
      default: {}
    }
  },
  methods: {
    todetail() {
      this.$router.push({
        path: "/bookdetailcity",
        query: { id: this.book.id }
      });
    }
  },
  computed: {
    ...mapGetters(["userID"])
  }
};
</script>

<style lang="scss" scoped>
@import "~@/assets/scss/const.scss";
@import "~@/assets/scss/mixin.scss";

.book-item-city {
  background: $app-background-color;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  margin: 20px;
  width: 90%;
  overflow: hidden;
  justify-content: center;
  align-items: center;
  img {
    display: block;
    width: 90px;
    min-width: 90px;
    height: 120px;
    margin-right: 10px;
    background: #e9e9e9;
  }
  .content {
    flex: 1;
    line-height: 20px;
    font-size: 12px;
    color: #999999;
    font-family: PingFang-SC-Medium;
    line-height: 30px;
    min-width: 0;
    .title {
      font-size: 16px;
      color: #1a1a1a;
      margin-bottom: 8px;
      @include ellipsis(1);
    }
    .price {
      color: #eb4c43;
    }
    .gold {
      font-size: 11px;
      color: #999999;
      margin-bottom: 8px;
      @include ellipsis(1);
    }
  }
  button {
    width: 60px;
    min-width: 60px;
    font-size: 12px;
    color: #ffffff;
    height: 25px;
    border-radius: 13px;
  }
}
</style>
